package com.tanhua.model.vo;

import com.tanhua.model.domain.UserInfo;
import com.tanhua.model.mongo.Voice;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 桃花传音返回对象
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PeachblossomVo {
    private Long userId;//用户id
    private String avatar;//头像
    private String nickname;//昵称
    private String gender;//性别
    private Integer age;//年龄
    private String soundUrl;//语音地址
    private Integer remainingTimes;//剩余次数

    public static PeachblossomVo init(UserInfo userInfo, Voice item) {
        PeachblossomVo peachblossomVo = new PeachblossomVo();
        peachblossomVo.setUserId(item.getUserId());
        peachblossomVo.setAvatar(userInfo.getAvatar());
        peachblossomVo.setNickname(userInfo.getNickname());
        peachblossomVo.setGender(userInfo.getGender());
        peachblossomVo.setAge(userInfo.getAge());
        peachblossomVo.setSoundUrl(item.getVoiceUrl());
        return peachblossomVo;
    }
}
